//
//  MyClass.h
//  HelloWorld
//
//  Created by tony wang on 12-2-18.
//  Copyright 2012年 tw. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "NewBase64.h"

typedef enum
{
    EScheduleType_plan = 1,     //计划
    EScheduleType_deed,     //记录
    EScheduleType_birthday, //生日
    EScheduleType_payday,   //缴费日
    EScheduleType_activity, //活动
    EScheduleType_all       //全部
}EScheduleType;

@interface MyClass : NSObject{
    NSString* userName;
    NSString* token;
    BOOL validated;
	//NSURL *api;
    NSMutableArray *personMarkList;
    EScheduleType scheduleType;
    NSString* scheduleTypeStr;
    CFGregorianDate selectDate;
}

@property (nonatomic) CFGregorianDate selectDate;
@property (nonatomic,assign) EScheduleType scheduleType;
@property (nonatomic,retain) NSString* scheduleTypeStr;
@property (retain) NSString* userName;
@property (retain) NSString* token;
@property BOOL validated;
@property (nonatomic,retain) NSMutableArray *personMarkList;
@property (nonatomic) CGPoint touchPoint;
//获取单例
+ (MyClass *) getInstance;

//获取已存的用户名
- (NSString*) getStoredName;

////获取用户信息
- (void) getUser;

////请求 api
- (id) requestApi:(NSString *) api :(NSString *) jsonString;

//检查网络是否可用
//- (BOOL) connectedToNetwork;
- (BOOL) checkNet;

//检查用户是否已验证过（免登录）
- (NSMutableDictionary *) validatedUser;

//（根据用户名）申请 token
- (NSMutableDictionary *) generateToken:(NSString *) userName;

//获取（当前用户的）日程
- (NSMutableDictionary *) getSchedule:(NSDate *) fromDate toTime:(NSDate *) toDate;

//根据人物获取日程
- (NSDictionary *) getSchedule:(NSString *) withMark;

//获取某 type 的所有结果
- (NSDictionary*) getResultMeta:(NSString*)type;

//获取某 type 的某一类结果
- (NSDictionary*) getResultMeta:(NSString*)type ofKind:(NSString*)code;

//获取某 type 某 code 某 result 的文本
- (NSString*) getResultText:(NSString*)type ofKind:(NSString*)code ofResult:(NSString*)result;

//通过ID获取计划
- (NSMutableDictionary *) getPlan:(NSString*) byId;

//通过ID获取记录
- (NSDictionary *) getDeed:(NSString*) byId;

//编辑计划
- (NSDictionary *) editPlan:(NSDictionary*) content;
- (NSDictionary *) editDeed:(NSDictionary *) content;
//完成计划
- (NSDictionary *) finishPlan:(NSDictionary *) content;
- (NSDictionary *) listGroup;
//获取成员列表
- (NSDictionary *) getMembers: (NSString *) ofGroup ofType:(NSString *) ofType inOrder:(int) inOrder startAt:(int) startAt limit:(int) limit searchWith:(NSString *) searchWith;

//根据 markName 获取人物头像
- (NSDictionary *) getPersonImage: (NSArray *) withMarks;

//获取（本人）未读信息
- (NSDictionary *) getNewMessages: (int) startAt limit:(int) limit;

//根据 markName 获取信息
- (NSDictionary *) getNewMessages: (NSString *) withMark startAt:(int) startAt limit:(int) limit;

//标记消息为已读
- (NSDictionary *) markMessagesRead: (NSArray *) arrIds;

//删除消息
- (NSDictionary *) delMessages: (NSArray *) arrIds;

//
- (NSDictionary *) sendMessage: (NSString *) message _to:(NSArray *) _to;

//上传 apnsDeviceToken
- (NSDictionary *) sendApnsToken: (NSString *) apnsToken;
//换token
- (NSDictionary *) refreshToken;
@end